package io.github.uicdb.badskill.network;

import io.github.uicdb.badskill.PlayerSkillCapabilityProvider;
import lombok.RequiredArgsConstructor;
import net.minecraft.client.Minecraft;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraftforge.fml.LogicalSide;
import net.minecraftforge.network.NetworkEvent;

import java.util.function.Supplier;

@RequiredArgsConstructor
public class QueryAttributePackage {

    public  void toBytes(FriendlyByteBuf buf) {

    }

    public static QueryAttributePackage create(FriendlyByteBuf buf) {
        return new QueryAttributePackage();
    }

    public  void handle(Supplier<NetworkEvent.Context> contextSupplier) {
        var context=contextSupplier.get();
        context.enqueueWork(() -> {
            if(context.getDirection().getReceptionSide()== LogicalSide.SERVER){
                AtttributeValueSyncPackage.sendToClient(context.getSender());
            }});
        context.setPacketHandled(true);
    }
}
